package com.atguigu.gulimall.search.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GulimallElasticSearchConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient(){
        return new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost("192.168.137.150", 9200, "http")));
//        RestClientBuilder builder;
//        builder = RestClient.builder(new HttpHost("192.168.137.150", 9200, "http"));
//        RestHighLevelClient client = new RestHighLevelClient(builder);
//        return  client;
    }
}
